<template>
  <div class="board">
    <h3>房号信息</h3>
    <el-form ref="form" :inline="true" :model="sendInfo" style="width: 100%">
      <el-form-item label="单元名称">
        <el-input v-model="tableData.unitname" style="width: 500px"></el-input>
      </el-form-item>
     <el-form-item label="栋号">
        <el-input v-model="tableData.buildnum" style="width: 500px"></el-input>
      </el-form-item>
       <el-form-item label="楼层号">
        <el-input v-model="tableData.storeynum" style="width: 500px"></el-input>
      </el-form-item>
       <el-form-item label="房号">
        <el-input v-model="tableData.homenum" style="width: 500px"></el-input>
      </el-form-item>
       <el-form-item label="住客姓名">
        <el-input v-model="tableData.homename" style="width: 500px"></el-input>
      </el-form-item>
      <el-form-item label="状态选择">
        <el-select v-model="tableData.homestatus" placeholder="请选状态">
          <el-option label="已入住" :value="1"></el-option>
          <el-option label="未入住" :value="2"></el-option>
        </el-select>
      </el-form-item>
       <el-form-item label="房屋信息">
        <el-input type="textarea" v-model="tableData.homemessage" style="width: 500px"></el-input>
      </el-form-item>
      <el-form-item label="家庭成员">
        <el-input type="textarea" v-model="tableData.homesuggestion" style="width: 500px"></el-input>
      </el-form-item>
      
      
      
      <h2>智能设备</h2>
        <el-form-item label="洗衣机数量">
        <el-input v-model="tableData.washnum" style="width: 500px"></el-input>
      </el-form-item>
     <el-form-item label="WI-FI名称">
        <el-input v-model="tableData.wifiname" style="width: 500px"></el-input>
      </el-form-item>
       <el-form-item label="空调数量">
        <el-input v-model="tableData.airnum" style="width: 500px"></el-input>
      </el-form-item>
      <el-form-item label="智能设备状态">
        <el-select v-model="tableData.smartstatus" placeholder="请选状态">
          <el-option label="完好" :value="1"></el-option>
          <el-option label="待维修" :value="2"></el-option>
        </el-select>
      </el-form-item>


        <h2>家居设备</h2>
        <el-form-item label="书桌数量">
        <el-input v-model="tableData.homedesk" style="width: 500px"></el-input>
      </el-form-item>
     <el-form-item label="椅子数量">
        <el-input v-model="tableData.homechair" style="width: 500px"></el-input>
      </el-form-item>
       <el-form-item label="衣橱数量">
        <el-input v-model="tableData.homeclothes" style="width: 500px"></el-input>
      </el-form-item>
      <el-form-item label="家居设备状态">
        <el-select v-model="tableData.familystatus" placeholder="请选状态">
          <el-option label="完好" :value="1"></el-option>
          <el-option label="待维修" :value="2"></el-option>
        </el-select>
      </el-form-item>
    </el-form>

    <el-button  size="mini"> 取消</el-button>
    <el-button @click="she"  size="mini" type="primary">确定</el-button>
  </div>
</template>

<script>
import axios from "axios";
import Cookies from "js-cookie";
import Pagination from "@/components/Pagination";
export default {
  data() {
    return {
      fileList: [],
      queryInfo: [],
      srcList: [],
     
      tableData: [],
      sendInfo: {
        page: 1,
        limit: 20,
        sort: "add_time",
        order: "desc"
      },
      Token: "",
      componentTotal: 0,
      dialogFormVisible: false,
      onceInfo: {
        communityname: "",
        unitname: "",
        createDt: "",
        value: "",
        currPage: 1,
        pageNum: 10
      },
      token:
        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjEyLCJ1c2VybmFtZSI6ImFkbWluIiwiZW1haWwiOiJ3ZSIsImhlYWQiOiIyMDI0MDMwODE5Mzc1Nzg3MTE4OTAuanBnIiwidHlwZSI6IjEiLCJpYXQiOjE3MTE0MzU3ODEsImV4cCI6MTcxMTUyMjE4MX0.3nVHSPwNIWRhY7qJJHplVlLKDp9iIgVEZpZ9ZPBcoYI"
    };
  },
  methods: {
    // getTableData(){

    // },
    sss(){
        console.log(6666)
    },
    async shelves(id) {
      console.log(id);
      console.log(5)
      const { data: res } = await axios.get(
        `http://community.byesame.com/house/getDetailId?id=${id}&token=${this.Token}`,
        {
          params: this.sendInfo
        }
      );
      // this.$router.push("/message/number");
      console.log(6);
      console.log(res);
      console.log(this.tableData);
      this.tableData=(res[0]);
      console.log(this.tableData);
    },
    async she(){
      console.log(6)
      const { data: res } = await axios.post(
        `http://community.byesame.com/house/updatenumList?id=${this.id}&token=${this.Token}`,
        this.tableData,
        {
          params: this.tableData
        }
      );
     
      this.$router.push("/message/number");
      console.log(7);
      console.log(res);
      console.log(this.tableData);
    },
    created() {
      this.getTableData();
    }
  },
  mounted() {
    this.Token = Cookies.get("Admin-Token");
    this.id = this.$route.query.id;
    console.log(this.id); this.shelves(this.id)
    this.getTableData(this.id);
   

    
  },
  components: {
    Pagination
  },
  computed: {
    headers() {
      return {
        //上传图片时，携带请求头
        "X-Litemall-Admin-Token": this.Token
      };
    }
  }
};
</script>

<style lang="scss" scoped>
.board {
  padding: 20px;
}
.vatimg {
  width: 145px;
  height: 145px;
  display: block;
}
</style>